Open
Conversation
Move the HPKE (Hybrid Public Key Encryption) implementation from pure Python to Rust for improved performance. The implementation follows RFC 9180 and includes: - KEM: DHKEM(X25519, HKDF-SHA256) - KDF: HKDF-SHA256 - AEAD: AES-128-GCM - Mode: Base mode only The public API remains unchanged - KEM, KDF, AEAD enums and Suite class are now backed by Rust via PyO3. https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
- Use proper Rust enums with #[pyclass] for KEM, KDF, and AEAD types - Accept Python ABCs for keys using pyo3::PyAny and Python APIs - Remove unnecessary internal helper methods from x25519.rs - Simplify type stub file by removing unnecessary value properties - Update tests to work with pyo3's native type checking error messages https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
- Organize algorithm constants into modules for easy extension - Remove empty enum impl blocks and unnecessary __eq__/__hash__ from type stubs - Reuse hkdf_extract from kdf.rs (made pub(crate)) - Reuse EvpCipherAead from aead.rs (made pub(crate)) - Use Python API for x25519 key generation and exchange operations - Simplify code by removing duplicated HKDF and AEAD implementations https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
- Add LazyPyImport entries for X25519_PRIVATE_KEY, X25519_PUBLIC_KEY, HKDF_EXPAND, and AESGCM to types.rs - Replace manual HKDF expand implementation with Python HKDFExpand class - Use Python AESGCM for encryption/decryption instead of EvpCipherAead - Use LazyPyImport for X25519 key operations https://claude.ai/code/session_01W43m9LudrvqkHKr4BrMa7c
scutuatua-crypto
approved these changes
Jan 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.